//
//  YDBaseTableViewCell.m
//  IngCard
//
//  Created by kf on 2017/6/5.
//  Copyright © 2017年 IngDan. All rights reserved.
//

#import "YDBaseTableViewCell.h"

@implementation YDBaseTableViewCellDataSrouce

#pragma mark - for subClass
-(Class) viewClass
{
    return [YDBaseTableViewCell class];
}

#pragma mark - private
-(CGFloat) viewHeight
{
    return [[self viewClass] viewHeight:self];
}
@end



@interface YDBaseTableViewCell ()
@property(nonatomic, strong) UIImageView *accessoryImageView;
@end

@implementation YDBaseTableViewCell

#pragma mark - for subClass

+(CGFloat)viewHeight:(YDBaseTableViewCellDataSrouce *) dataSource
{
    return 60;//TableViewCellNormalHeight;
}
// addsubview  & makeCOnstraints
-(void) initSubviews
{
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

-(void) onViewModelChanged
{
    
}

-(UITableViewCellStyle) style
{
    return UITableViewCellStyleSubtitle;
}


#pragma mark - private
- (instancetype)initForTableView:(QMUITableView *)tableView withStyle:(UITableViewCellStyle)style
{
    if (self = [super initForTableView:tableView withStyle:style
                       reuseIdentifier:NSStringFromClass([self class])])
    {
        [self initSubviews];
    }
    return self;
}

+(NSString *)reuseIdentifier
{
    return NSStringFromClass([self class]);
}

#pragma mark - lazyLoad
-(void)setDataSource:(id<YDViewDataSource>)dataSource
{
    _dataSource = dataSource;
    [self onViewModelChanged];
}

#pragma mark - lazy load
-(UIImageView *)accessoryImageView
{
    if (!_accessoryImageView)
    {
        _accessoryImageView = [[UIImageView alloc] init];
        _accessoryImageView.contentMode = UIViewContentModeCenter;
        [_accessoryImageView sizeToFit];
    }
    return _accessoryImageView;
}


@end
